home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-07-24 | 5.8 KB | 166 lines | [TEXT/CWIE] |
- // --------------------------------------------------------------------------------------------
- // UGetMulltipleFiles 1.3.4 - An Add Files utility class
- // created: By David Hirsch, August 14, 1996
- // updated: By David Hirsch, July 4, 1997
- // --------------------------------------------------------------------------------------------
-
- /*
- This set of files implements an Add Files dialog box (like in CodeWarrior; as a matter of
- fact, I took the DLOG, DITL, and dctb from the Code Warrior IDE 1.6 application). It produces
- an LArray of FSSpec records. I stole bits and pieces of the code from a few sources, noted in
- the code.
-
- Method:
- I keep the real list of added files in an LArray of FSSpec records, and just show the name
- field in the displayed list. The algorithm should keep both the LArray and the list in the same
- order. I think this is much better than the method used in the Macintosh sample code, which has
- a three-column list, but only displays the first column, hiding the parID, and vRefNum columns.
-
- Restrictions:
- This is freeware. I retain copyright and must be notified if the source is sold for profit.
- If you use it in your code, credit would be appreciated.
-
- Requirements:
- This class uses LArray, LString, and UDrawingState, although it could be easily narrowed to
- just LArray.
-
- Disclaimer:
- I make no claims as to whether this works or is safe or nothin! It hasn't been robustly
- tested. (Bug reports are appreciated at dhirsch@mail.utexas.edu).
-
- Files you need to use:
- UGetMultipleFiles.rsrc - has the DLOG, DITL, and dctb resources
- UGetMultipleFiles.cp - the guts of the class
- UGetMultipleFiles.h
- LFSSpecArrayComp.cp - the FSSpec comparator for the LArray
- LFSSpecArrayComp.h
- GetDirItems.c - a tiny bit of MoreFiles, returns an array of FSSpecs for a directory
- GetDirItems.h
-
- Demonstration files you can toss out:
- Read Me (this file)
- Exhibit FAT - the demonstration application
- Exhibit 68K.µ - demo project (68K)
- Exhibit FAT.µ - demo project (FAT)
- Exhibit.cp - demo application class
- Exhibit.h
- Exhibit.rsrc - (taken from Starter Source)
-
- Known Bugs:
- - Leaks small (size about 8) handle each time through. Looks like it's coming from either CW,
- PP, or the Toolbox. I've posted it to the newsgroups as of today (3/6/97)
- - (Follow-up) Got confirmation that it's the Toolbox that leaks. Sheesh!
-
- Future Improvements:
- - Show Icons in lists
- - Drag and Drop from one list to other (yeah, like I'm gonna code *that* real soon!)
- - Key equivalent for removing files
-
- Special Thanks:
- Thanks to Norman Franke for figuring out a bug that had me stumped for over a week!
- Thanks to Thomas Engelmeier and Scott Lasley for code contributions that fixed
- compatibility problems.
- Thanks to Paul Baxter (c/o www.experts-exchange.com) for a LNew patch to get the
- Toolbox-made list's ListHandle
-
- Version History:
- 2.0.0 - 7/24/97:
- Added lots of cool features, after getting a patch that gives me the ListHandle for
- the list the toolbox makes - endless thanks to Paul Baxter!
- Implemented adding folders/volumes (and got paid for it, too!)
- Can now navigate in both lists using keyboard
- 1.3.4 - 7/4/97: (not released)
- Removed number of files limit (was 100). Thanks to Stephen Jensen for pointing out
- the bug, and giving me his fix.
- The sample program is now in CWPro 1.
- 1.3.3 - 3/30/97:
- Added code to supress all checking including translation, locked file alerts, etc.
- This replaces the MAE code from Thomas Engelmeier.
-
- 1.3.2 - 3/16/97: (not released)
- Added code to work around MacEasyOpen compatibility problem (Code contributed
- by Thomas Engelmeier - Many thanks!)
- Added code to work around NOW SuperBoomerang DirectOpen compatibility problem (Code
- contributed by Scott Lasley - Also, Many Thanks!)
- Changed names of *static* data members from m* to s*
-
- 1.3.1 - 3/10/97:
- Fixed bug where removed files didn't reappear in the top list
- Fixed bug where selection didn't disappear when deactivating bottom list
-
- 1.3 - 3/6/97:
- Fixed crashing bug when subordinate dialogs are produced
- Fixed problem in LFSSpecArrayComp
- Added double-clicking to remove items
- Added exclusion list support
- Added filtering of added files from main list
- Thanks to Jeff Schmidt for bug reports
-
- 1.2 - 9/18/96:
- Fixed Add All 68K crash bug (thanks to Norman Franke)
- Added highlighting for list boxes
- Fixed button enabling/disabling
-
- 1.1 - 9/1/96 - Interim version (not released).
- Found work-around for Add All crash bug on 68K.
-
- 1.0 - 8/14/96 - Initial release (unnumbered)
-
- */
-
- - Dave Hirsch, dhirsch@mail.utexas.edu
-
- /* Thanks to Thomas Engelmeier who sent me the following;
- He thought it might be useful with this class:
-
- - I guess, the SendAEOpenMultipleDocs() routine might be useful for all
- users of your Fileselector:
-
- void
- SendAEOpenMultipleDocs(
- LArray *inArray )
- {
- FSSpec theFSS;
- OSErr err;
- AEDescList aliasList;
- AEDesc aliasDesc;
- AliasHandle aliasH;
-
- // Create the descList to hold the list of files
-
-
- Try_ {
- AppleEvent openEvent;
- UAppleEventsMgr::MakeAppleEvent(kCoreEventClass, kAEOpen, openEvent);
- err = AECreateList(NULL, 0, false, &aliasList);
-
- for (short i = 1; i <= inArray->GetCount(); i++)
- {
- inArray->FetchItemAt(i, &theFSS);
-
- aliasDesc.descriptorType = typeAlias;
-
- // Now we add the file to descList by creating an alias and then
- // adding it into the descList using AEPutDesc
-
- err = NewAlias(NULL, &theFSS, &aliasH);
- aliasDesc.dataHandle = (Handle)aliasH;
- err = ::AEPutDesc(&aliasList, 0, &aliasDesc);
- DisposeHandle((Handle)aliasH);
- }
- err = ::AEPutParamDesc(&openEvent, keyDirectObject, &aliasList);
- ThrowIfOSErr_(err);
-
- UAppleEventsMgr::SendAppleEvent(openEvent);
- }
-
- Catch_(inErr) {
- for (short i = 1; i <= inArray->GetCount(); i++)
- {
- inArray->FetchItemAt(i, &theFSS);
- OpenDocument(&theFSS);
- }
- } EndCatch_
- }
- */
-